package evan.curtis.beersnob.util;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;

import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;

public final class UIFunctions {

	public static DialogViewPair createAlertDialog(Activity a, String title, int menuResource) {
		AlertDialog dialog = new AlertDialog.Builder(a).create();
		dialog.setTitle(title);
		LinearLayout linear = new LinearLayout(a);
		linear.setOrientation(LinearLayout.VERTICAL);
		dialog.setView(linear);
		LayoutInflater inflater = (LayoutInflater)
				a.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		
		View volumeView = inflater.inflate(menuResource, linear);
		
		return new DialogViewPair(dialog, volumeView);
	}
	
}
